package com.hunliji.monitor.manager.rest;

import com.hunliji.monitor.manager.api.model.dto.gitlab.GitlabDiscussion;
import com.hunliji.monitor.manager.api.model.dto.gitlab.GitlabUser;
import org.springframework.cloud.openfeign.FeignAutoConfiguration;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.*;

/**
 * 对接飞书的接口
 *
 * @author hunliji
 */
@FeignClient(name = "gitlab", url = "https://git-vpn.hunliji.com:8109/api/v4", path = "", configuration = FeignAutoConfiguration.class)
public interface GitLabRest {

    @GetMapping(value = "/projects/{projectId}/merge_requests/{mergeRequestId}/discussions/{discussionId}",consumes = "application/json", produces = "application/json")
    GitlabDiscussion getDiscussion(
            @PathVariable("projectId") int projectId,
            @PathVariable("mergeRequestId") int mergeRequestId,
            @PathVariable("discussionId") String discussionId,
            @RequestHeader("PRIVATE-TOKEN") String authorization
    );

    @GetMapping(value = "/users/{userId}",consumes = "application/json", produces = "application/json")
    GitlabUser getUserInfo(
            @PathVariable("userId") int userId,
            @RequestHeader("PRIVATE-TOKEN") String authorization
    );

}
